<!-- layout-features.vue - 布局功能设置 -->
<template>
  <div class="drawer-item">
    <div class="drawer-item-header">
      <el-icon><Operation /></el-icon>
      <span>布局功能</span>
    </div>
    
    <div class="feature-list">
      <!-- 开启动画 -->
      <div class="feature-item">
        <div class="feature-label">
          <el-icon><VideoPlay /></el-icon>
          <span>页面动画</span>
        </div>
        <el-switch 
          v-model="layoutSetting.enableAnimation"
          inline-prompt
          active-text="开"
          inactive-text="关"
        />
      </div>
      
      <!-- 显示标签页 -->
      <div class="feature-item">
        <div class="feature-label">
          <el-icon><Files /></el-icon>
          <span>多标签页</span>
        </div>
        <el-switch 
          v-model="layoutSetting.showTabs"
          inline-prompt
          active-text="开"
          inactive-text="关"
        />
      </div>
      
      <!-- 显示页脚 -->
      <div class="feature-item">
        <div class="feature-label">
          <el-icon><Bottom /></el-icon>
          <span>页脚</span>
        </div>
        <el-switch 
          v-model="layoutSetting.showFooter"
          inline-prompt
          active-text="开"
          inactive-text="关"
        />
      </div>
      
      <!-- 灰色模式 -->
      <div class="feature-item">
        <div class="feature-label">
          <el-icon><Filter /></el-icon>
          <span>灰色模式</span>
        </div>
        <el-switch 
          v-model="layoutSetting.isGrey"
          inline-prompt
          active-text="开"
          inactive-text="关"
          @change="handleGreyModeChange"
        />
      </div>
      
      <!-- 色弱模式 -->
      <div class="feature-item">
        <div class="feature-label">
          <el-icon><View /></el-icon>
          <span>色弱模式</span>
        </div>
        <el-switch 
          v-model="layoutSetting.isWeak"
          inline-prompt
          active-text="开"
          inactive-text="关"
          @change="handleWeakModeChange"
        />
      </div>
    </div>
  </div>
</template>

<script setup>
import { useLayoutManage } from '@/layouts/layoutManage.js'
import { 
  Operation, 
  VideoPlay, 
  Files, 
  Bottom, 
  Filter, 
  View 
} from '@element-plus/icons-vue'

const { layoutSetting } = useLayoutManage()

// 灰色模式切换
function handleGreyModeChange(value) {
  if (value) {
    document.documentElement.style.filter = 'grayscale(1)'
  } else {
    document.documentElement.style.filter = ''
  }
}

// 色弱模式切换
function handleWeakModeChange(value) {
  if (value) {
    document.documentElement.style.filter = 'invert(0.8)'
  } else {
    document.documentElement.style.filter = ''
  }
}
</script>

<style lang="scss" scoped>
.feature-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 12px;
}

.feature-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border-radius: 8px;
  background: var(--el-bg-color);
  border: 1px solid var(--el-border-color-lighter);
  transition: all 0.3s;
  
  &:hover {
    border-color: var(--el-border-color-light);
    background: var(--el-fill-color-lighter);
  }
  
  .feature-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--el-text-color-primary);
    
    .el-icon {
      font-size: 16px;
      color: var(--el-text-color-regular);
    }
  }
}
</style>

